package com.java1412.config;

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;

/**
 * @author java1412
 * @create 2021-07-20 14:45
 */
@Component
public class MyHealthIndicator implements HealthIndicator {
    @Override
    public Health getHealth(boolean includeDetails) {
        return null;
    }

    @Override
    public Health health() {
        //自定义的检查方式
        Health.up().build();// 代表健康，服务没问题
        // 服务挂了
        Health.down().withDetail("message", "服务异常").build();
        return null;
    }
}
